import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


import javax.swing.*;
public class guis extends JFrame implements ActionListener{
	JPanel mainpanel;
	JLabel nuum1;
	JLabel nuum2;
	JLabel operation;
	JTextField num1;
	JTextField operatioon;
	JTextField num2;
	JButton ans;
	JOptionPane pop;
	JTextField anss;
	public guis(){
		setTitle("Hello");//top of screen title
		setSize(500,500);//size of screen
		setDefaultCloseOperation(EXIT_ON_CLOSE);//closes 
		SetUpPanel();
		this.add(mainpanel);
	}
	public void SetUpPanel(){
		ans = new JButton("=");
		pop = new JOptionPane();
		anss = new JTextField("Answer: ");
		mainpanel = new JPanel();
		nuum1 = new JLabel("First Number: ");
		nuum2 = new JLabel("Second Number: ");
		operation = new JLabel("Operation:");
		operatioon = new JTextField(5);
		num1 = new JTextField(5);
		num2 = new JTextField(5);
		ans.addActionListener(this);
		FlowLayout layout = new FlowLayout();
		mainpanel.setLayout(layout);
		mainpanel.add(nuum1);
		mainpanel.add(num1);
		mainpanel.add(operation);
		mainpanel.add(operatioon);
		mainpanel.add(nuum2);
		mainpanel.add(num2);
		mainpanel.add(ans);
	}
	public static void main(String[] args) {
		guis hello = new guis();//create instance of the function
		hello.setVisible(true);//makes visible
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
		String number1 = num1.getText();
		int num_1 = Integer.parseInt(number1);
		String number2 = num2.getText();
		int num_2 = Integer.parseInt(number2);
		int input =0;
		String ope = operatioon.getText();
		if (ope.compareTo("+")==0||ope.compareTo("addition")==0){
			System.out.println("Cats.");
			input = num_1+num_2;
		}
		else if (ope.compareTo("-")==0||ope.compareTo("subtraction")==0){
			System.out.println("Cats.");
			input = num_1-num_2;
		}
		else if (ope.compareTo("*")==0||ope.compareTo("multiplication")==0){
			input = num_1*num_2;
			System.out.println("Cats.");
		}
		else if (ope.compareTo("/")==0||ope.compareTo("division")==0){
			System.out.println("Cats.");
			input = num_1/num_2;
		}
		System.out.println("Dogs.");
		JOptionPane.showMessageDialog(this, input, "Pop up", JOptionPane.PLAIN_MESSAGE);
	}
}
